<template>
	<view class="pad-30">
		<view class="text-center">{{info.title}}</view>
		<view class="text-right mar-top-40 color-646464 font-28">
			{{timeFormat(info.created_at, 'yyyy-mm-dd hh:MM:ss')}}
		</view>
		<view class="mar-top-40">
			<up-parse :tagStyle="styles" :selectable="true" :content="info.content"></up-parse>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { noticeDetail } from '@/api/index.js';
	import { onLoad } from '@dcloudio/uni-app';
	import { timeFormat } from '@/node_modules/uview-plus';

	const info = ref({});
	onLoad((option) => {
		noticeDetail({ id: option.id }).then(res => {
			if (res.code == 200) {
				info.value = res.data.info;
			}
		})
	})

	// 样式对象，可以直接绑定到元素上  
	const styles = {
		// 为 table 标签添加边框和宽度
		table: 'border: 1px solid black; border-collapse: collapse;',
		// 为 td 和 th 标签添加边框和内边距
		td: 'border: 1px solid black;',
		th: 'border: 1px solid black;'
	};
</script>

<style scoped>
	#table table {
		border: 1px solid black;
		border-collapse: collapse;
	}

	#table td,
	#table th {
		border: 1px solid black;
		padding: 8px;
	}
</style>